package com.example.mybatisplus.demo.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatisplus.demo.service.StudentService;
import com.example.mybatisplus.demo.entity.Student;
import com.example.mybatisplus.demo.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired(required = false)
    private StudentMapper studentMapper;
    @Override
    public List<Student> getAllStudent(Integer page, Integer limit) {
        IPage<Student> studentIPage=new Page<>(page,limit);
        IPage<Student> result= studentMapper.selectPage(studentIPage,null);
        List<Student> students=result.getRecords();
        return students;
    }
}
